<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.cms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../check_right.jsp" %>
<%@ include file="../init_include.jsp" %>

<%		
	Vector vc=new Vector();
	try	{
		vc=SysRole.getRoles(dbi);
	} catch (Exception e)	{
		out.println(e);
		return;
	} finally	{
		dbi.closeAll();
	}		
%>
<html>
<head>
<script language="javascript">

function doAction(actUrl)
{
	document.roleList.action=actUrl;
	//window.alert(document.categoryShow.action);
	document.roleList.submit();
}

</script>
<link rel="stylesheet" href="../css.css" type="text/css">
</head>
<body>
<form method="post" name="roleList">
<%=Language.getNameByCode("sys.role.list","Role List")%><hr>
<table  border="0" width="100%" cellspacing="1" cellpadding="2" bgcolor="#666666" height="53">
  <tr class="bgcolor_title_tr"> 
      <td width="34" rowspan="3" height="25" class="role_title"><%=Language.getNameByCode("sys.select","Select")%></td>
      <td width="127" rowspan="3" height="25" class="role_title"><%=Language.getNameByCode("sys.role.rolename","Role Name")%></td>
      <td width="424" colspan="9" height="16" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.privilege","Privilege")%></p>
      </td>
      <td width="65" rowspan="3" height="25" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.comment","Comment")%></p>
      </td>
    </tr>
    <tr class="bgcolor_title_tr"> 
      <td width="172" colspan="4" height="16" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.category","Category")%></p>
      </td>
      <td width="193" colspan="4" height="16" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.Item","Information")%></p> 
      </td>
      <td rowspan="2" height="17" class="role_title" width="52">
        <p align="center"><%=Language.getNameByCode("sys.Check","Checked")%></p>
      </td>
    </tr>
    <tr class="bgcolor_title_tr"> 
      <td width="51" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Add","Add")%></p>
      </td>
      <td width="51" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Delete","Delete")%></p>
      </td>
      <td width="51" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Modify","Modify")%></p>
      </td>
      <td width="51" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Browse","Browse")%></p>
      </td>
      <td width="52" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Add","Add")%></p>
      </td>
      <td width="52" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Delete","Delete")%></p>
      </td>
      <td width="52" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Modify","Modify")%></p>
      </td>
      <td width="52" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Browse","Browse")%></p>
      </td>
    </tr>
 
<%
	
	String tmpStr;
	for (int i=0;i<vc.size();i++)
	{
		SysRole cr=(SysRole)vc.get(i);
		String name=cr.getName();
		
		tmpStr ="<tr bgcolor=\"#FFFFFF\" align=\"left\" valign=\"middle\"> \n";
		tmpStr+="<td width=\"8%\" height=\"16\"><input type=\"checkbox\" name=\"checkbox";
		tmpStr+=i+"\" value=\""+cr.getId()+"\"></td>";
		
		tmpStr+="<td width=\"12%\" height=\"16\">"+name+"</td>\n";
		for (int k=0;k<9;k++)
		{
			tmpStr+="<td width=\"8%\" height=\"16\">\n<input type=\"checkbox\" name=\"checkbox";
			tmpStr+=String.valueOf(i)+String.valueOf(k)+"\" value=\"checkbox\"";
			if (cr.testBit(k)) tmpStr+=" checked> </td>\n";
			else	tmpStr+="> </td>\n";
		}
		tmpStr+="<td>"+cr.getDescription()+"</td>\n</tr>\n";
		out.println(tmpStr);
	}
	
%>
</table>
<input type="hidden" name="roleNum" value="<%=vc.size() %>" >
<input type="button" name="Button" value="<%=Language.getNameByCode("sys.Modify","Modify")%>" onClick='doAction("sysRole_change.jsp")'><input type="button" name="Button" value="<%=Language.getNameByCode("sys.Delete","Delete")%>" onClick='doAction("sysRole_del.jsp")'>
</form>

<form method="post" name="roleAdd" action="sysRole_add.jsp">
<%=Language.getNameByCode("sys.role.addrole","Add Role")%><hr>
<table  border="0" width="100%" cellspacing="1" cellpadding="2" bgcolor="#666666" height="1">
    <tr class="bgcolor_title_tr"> 
      <td width="158" rowspan="2" height="1" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.rolename","Role Name")%></p>
      </td>
      <td width="150" colspan="4" height="12" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.category","Category")%></p>
      </td>
      <td width="177" colspan="4" height="12" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.Item","Information")%></p>
      </td>
      <td rowspan="2" height="13" class="role_title" width="46">
        <p align="center"><%=Language.getNameByCode("sys.role.privilege","Privilege")%></p>
      </td>
      <td width="113" rowspan="2" height="1" class="role_title"> 
        <p align="center"><%=Language.getNameByCode("sys.role.comment","Comment")%></p>
      </td>
    </tr>
    <tr class="bgcolor_title_tr"> 
      <td width="45" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Add","Add")%></p>
      </td>
      <td width="45" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Delete","Delete")%></p>
      </td>
      <td width="45" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Modify","Modify")%></p>
      </td>
      <td width="45" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Browse","Browse")%></p>
      </td>
      <td width="45" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Add","Add")%></p>
      </td>
      <td width="46" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Delete","Delete")%></p>
      </td>
      <td width="46" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Modify","Modify")%></p>
      </td>
      <td width="46" height="1" class="role_title">
        <p align="center"><%=Language.getNameByCode("sys.Browse","Browse")%></p>
      </td>
    </tr>
    <tr class="bgcolor_title_tr" align="left" valign="middle"> 
      <td width="158" height="1"> 
        <input type="text" name="name" size="15">
      </td>
      <td width="45" height="1"> 
        <input type="checkbox" name="checkbox0" value="checkbox">
      </td>
      <td width="45" height="1"> 
        <input type="checkbox" name="checkbox1" value="checkbox">
      </td>
      <td width="45" height="1"> 
        <input type="checkbox" name="checkbox2" value="checkbox">
      </td>
      <td width="45" height="1"> 
        <input type="checkbox" name="checkbox3" value="checkbox">
      </td>
      <td width="45" height="1"> 
        <input type="checkbox" name="checkbox4" value="checkbox">
      </td>
      <td width="46" height="1"> 
        <input type="checkbox" name="checkbox5" value="checkbox">
      </td>
      <td width="46" height="1"> 
        <input type="checkbox" name="checkbox6" value="checkbox">
      </td>
      <td width="46" height="1"> 
        <input type="checkbox" name="checkbox7" value="checkbox">
      </td>
      <td width="46" height="1"> 
        <input type="checkbox" name="checkbox8" value="checkbox">
      </td>
      <td width="113" height="1"> 
        <input type="text" name="description" size="15">
      </td>
    </tr>
  </table>

<input type="submit" value="<%=Language.getNameByCode("sys.Add","Add")%>" name="B1"><input type="reset" value="<%=Language.getNameByCode("sys.Reset","Reset")%>" name="B2">
</form>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="role_title">
  <tr>
    <td><i>(*<%=Language.getNameByCode("sys.role.comment","Role is a opertioner!")%>)
    </i></td>
  </tr>
</table>
</body>
</html>
<%@ include file="../init_free.jsp" %>